﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Laundry_Default" %>



<asp:Content ID="Content4" ContentPlaceHolderID="title" Runat="Server">
    Cortes
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderBreadcrumbs" Runat="Server">
    <ul>
        <li>Lavanderia</li>
    </ul>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceMain" Runat="Server">

    <h2 class="pagetitle">Notas de Recibo</h2>
    <div class="block">
        <asp:TextBox ID="txtSearchTerm" runat="server" class="fields-filter" style="margin-right:0px;" Text=""></asp:TextBox>
        <asp:ImageButton class="button-filter" runat="server" ID="btnSearch" AlternateText="Buscar" ToolTip="Buscar" OnClick="btnSearch_Click" ImageUrl="~/img/search-icon.png"/>
    </div>
    <div class="column1-unit">
        <div class="container-add-button"><asp:LinkButton runat="server" ID="lnkAdd" CssClass="add-button" Text="Agregar" OnClick="lnkAdd_Click"></asp:LinkButton> </div>
        <asp:gridview ID="grid" runat="server" OnPageIndexChanging="grid_PageIndexChanging" OnSorting="grid_Sorting" DataSourceID="ds" 
            AutoGenerateColumns="False" EmptyDataText="No Existen Registros" AllowPaging="True" PageSize="10" DataKeyNames="Id" 
            OnRowCommand="grid_RowCommand" BorderWidth="1" CellPadding="5" CellSpacing="0" ShowFooter="false" AlternatingRowStyle-CssClass="row-alternation" OnRowDataBound="grid_RowDataBound" >
                <Columns>  

                   <asp:TemplateField HeaderText="Fecha" HeaderStyle-CssClass="top" HeaderStyle-Width="80px" SortExpression="Date">
                        <ItemTemplate>    
                            <asp:Label ID="lblDate" runat="server" Text='<%# Bind("Date","{0:dd/MM/yyyy}") %>'></asp:Label>     
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="C.I/Rif" HeaderStyle-CssClass="top" SortExpression="ClientDocumentId">
                        <ItemTemplate>    
                            <asp:Label ID="lblClientDocumentId" runat="server" Text='<%# Bind("ClientDocumentId") %>'></asp:Label>     
                        </ItemTemplate>
                    </asp:TemplateField>
                     <asp:TemplateField HeaderText="Cliente" HeaderStyle-CssClass="top" SortExpression="ClientName">
                        <ItemTemplate>    
                            <asp:Label ID="lblClientName" runat="server" Text='<%# Bind("ClientName") %>'></asp:Label>     
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderStyle-CssClass="top" HeaderStyle-Width="60px" ItemStyle-CssClass="status" FooterStyle-CssClass="status">
                        <HeaderTemplate>
                            Acciones
                        </HeaderTemplate>
                        <ItemTemplate> 
                            <asp:ImageButton ToolTip="Ver nota de recibo" ID="imgEdit" runat="server" CausesValidation="False" CommandName="EditNote" 
                                ImageUrl="~/img/edit-icon.png" height="16px" CommandArgument='<%# Eval("Id") %>'></asp:ImageButton> 
                            <asp:ImageButton ToolTip="Eliminar nota de recibo" ID="imgDelete" runat="server" CausesValidation="False" CommandName="DeleteRow" 
                                OnClientClick='<%# GetConfirmValue(Eval("Id").ToString()) %>' 
                                ImageUrl="~/img/delete-icon.png" height="16px"></asp:ImageButton> 
                        </ItemTemplate> 
                    </asp:TemplateField>
                </Columns>
            </asp:gridview>
             <asp:ObjectDataSource ID="ds" runat="server" TypeName="BLLLaundry" SelectMethod="GetReceivedNotes"
                EnablePaging="true" SelectCountMethod="GetReceivedNotesCount" StartRowIndexParameterName="startRow"
                MaximumRowsParameterName="pageSize" SortParameterName="sortColumns" UpdateMethod="Update">        
                <SelectParameters>
                    <asp:SessionParameter  DefaultValue="" Name="sortExp" SessionField="sortExp" Type="String" />
                    <asp:SessionParameter DefaultValue="" Name="sortDirection" SessionField="sortDirection" Type="String" />
                    <asp:SessionParameter  DefaultValue="" Name="pageIndex" SessionField="pageIndex" Type="Int32" />
                    <asp:SessionParameter  DefaultValue="" Name="filterSearch" SessionField="filterSearch" Type="String" />
                </SelectParameters>              
            </asp:ObjectDataSource>
        </div>
        <asp:HiddenField runat="server" ID="hdnId" />
         <asp:Button runat="server" ID="lnkDelete" OnClick="lnkDelete_Click" style="display:none;"></asp:Button>
        <div id="dialog" style="display:none;"></div>
    <script type="text/javascript">

        function confirmMessage(title, message, id) {
            $("#dialog").html(message);
            $("#<%=hdnId.ClientID %>").val(id);
            $("#dialog").dialog(
                {
                    modal: true,
                    title: title,
                    buttons: 
                    {
                        "Ok": function () {
                            $(this).dialog("close");
                            $("#<%=lnkDelete.ClientID %>").click();
                        },
                        "Cancelar": function () {
                            $(this).dialog("close");
                        }
                    }
                });
            return false;
        }
    </script>
</asp:Content>

